package com.league.zjxn.jetpack.vmodel

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.league.zjxn.base.BaseViewModel
import com.league.zjxn.entity.ContactUsResponse
import com.league.zjxn.entity.HomeDataResponse
import com.league.zjxn.entity.MessageResponse
import com.league.zjxn.jetpack.repository.HomeRepository
import com.league.zjxn.jetpack.repository.MessageRepository
import com.league.zjxn.jetpack.repository.UserRepository
import com.module.lemlin.http.HttpResponseBody
import com.module.lemlin.http.HttpResponseData
import com.module.lemlin.http.SubscribeViewModel


class MessageViewModel(application: Application) : BaseViewModel(application) {

    private val mMessageRepository: MessageRepository = MessageRepository()

    val messageListLiveData = MutableLiveData<HttpResponseBody<MessageResponse>>()
    fun messageList() {
        setRxLifeScope(SubscribeViewModel(messageListLiveData)) {
            mMessageRepository.messageList(page = "1", limit = "50")
        }
    }

    val messageReadLiveData = MutableLiveData<HttpResponseBody<HttpResponseData>>()
    fun messageRead(type: String, id: String = "") {
        setRxLifeScope(SubscribeViewModel(messageReadLiveData)) {
            mMessageRepository.messageRead(type, id)
        }
    }

}